package com.cxyzy.aopdemo;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import static com.cxyzy.aopdemo.Constant.AFTER_LOGIN_INTENT;

public class LoginActivity extends AppCompatActivity implements View.OnClickListener {
    private Intent afterLoginIntent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        findViewById(R.id.loginButton).setOnClickListener(this);
        afterLoginIntent = getIntent().getParcelableExtra(AFTER_LOGIN_INTENT);
    }

    @Override
    public void onClick(View v) {
        Constant.isLogged = true;
        if (afterLoginIntent != null) {
            startActivity(afterLoginIntent);
        }
        this.finish();
    }
}
